package propertyManager;

import java.util.Map;
import java.util.HashMap;
import java.awt.RenderingHints;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Dimension;
import java.awt.Point;
import main.*;
import stateManager.*;


/* Class Properties
 * Singleton class
 */
public class PropertyManager {

	private static PropertyManager propertyManager = null;
	private Map<String, Property> propertyHashMap = new HashMap<String, Property>();
	private static PropertyDefaultValues propDefValues = new PropertyDefaultValues(); 
	
	private PropertyManager() {
		
		
	}	
	
	public static PropertyManager  getInstance() {
		if(propertyManager == null) {
			synchronized(PropertyManager.class) { 
				propertyManager = new PropertyManager ();
		     }
		}
		return propertyManager;
	}	
	
	public void set(String key, int value){
		Property<Integer> property = new Property<Integer>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, short value){
		Property<Short> property = new Property<Short>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, double value){
		Property<Double> property = new Property<Double>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, float value){
		Property<Float> property = new Property<Float>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, boolean value){
		Property<Boolean> property = new Property<Boolean>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, char value){
		Property<Character> property = new Property<Character>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, long value){
		Property<Long> property = new Property<Long>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, String value){
		Property<String> property = new Property<String>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, RenderingHints value){
		Property<RenderingHints> property = new Property<RenderingHints>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, Object value){
		Property<Object> property = new Property<Object>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, Sprite value){
		Property<Sprite> property = new Property<Sprite>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, State value){
		Property<State> property = new Property<State>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, Color value){
		Property<Color> property = new Property<Color>(value);
		propertyHashMap.put(key, property);
	}
	public void set(String key, Point value){
		Property<Point> property = new Property<Point>(value);
		propertyHashMap.put(key, property);
	}
	public <X> X find(String key){
		
		return (X)propertyHashMap.get(key).get();
		
	}
}
